<?xml version="1.0" encoding="us-ascii"?>
<hrc version="take5"
xmlns="http://colorer.sf.net/2003/hrc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://colorer.sf.net/2003/hrc http://colorer.sf.net/2003/hrc.xsd">

<type name="r">
<annotation><documentation><![CDATA[

r.hrc by Roman Kuzmin 2012-04-01
Distributed with ColorerPack: http://code.google.com/p/farnet

Add to proto.hrc:

<prototype name="r" group="scripts" description="R">
<filename>/\.(R|Rhistory|Rprofile)$/i</filename>
<location link="..."/>
</prototype>

]]></documentation></annotation>

<region name="Comment"       parent="def:Comment"       description="R comments."/>
<region name="Constant"      parent="def:Constant"      description="R constants."/>
<region name="Escape"        parent="def:StringContent" description="Escaping backslashes and escaped symbols."/>
<region name="Identifier"    parent="def:Identifier"/>
<region name="Keyword"       parent="def:Keyword"       description="R keywords."/>
<region name="Operator"      parent="def:Operator"      description="R operators."/>
<region name="Separator"     parent="def:Symbol"        description="Comma and semicolon."/>
<region name="String"        parent="def:String"        description="Literal text in strings."/>
<region name="StringEdge"    parent="def:StringEdge"    description="Quotation marks: ', &#34;, `."/>
<region name="UserOperator"  parent="def:Prefix"        description="xxx in user-defined operator %xxx%."/>

<region name="Number"        parent="def:Number"/>
<region name="NumberDec"     parent="def:NumberDec"     description="Decimal numbers."/>
<region name="NumberHex"     parent="def:NumberHex"     description="Hexadecimal numbers."/>
<region name="NumberFloat"   parent="def:NumberFloat"   description="Floating point numbers."/>

<region name="start" parent="def:PairStart"/>
<region name="end" parent="def:PairEnd"/>

<entity name="hex" value="[0-9a-fA-F]"/>
<entity name="id" value="(?:\b[a-zA-Z]|\.(?:\D|$)?=)[\w.]*"/>

<entity name="numexp" value="(?:[eE][\-+]?\d+)"/>
<entity name="numsuf" value="[Li]?"/>

<scheme name="String">
	<regexp match="/(?{Escape}\\(?:['&#34;nrtbafv\\]|[0-7]{1,3}|x%hex;{1,2}|u(?:%hex;{1,4}|\{%hex;{1,4}\})|U(?:%hex;{1,8}|\{%hex;{1,8}\})))/"/>
</scheme>

<scheme name="Number">
	<regexp region="NumberFloat" match="/\B\.?~1\.\d+%numexp;?%numsuf;\b/"/>
	<regexp region="NumberFloat" match="/\b\d+\.\.?!\d*(?:%numexp;?%numsuf;\b|\B)/"/>
	<regexp region="NumberFloat" match="/\b\d+%numexp;%numsuf;\b/"/>
	<regexp region="NumberHex" match="/\b0[xX]%hex;+(?:[pP]\d+)?%numsuf;\b/"/>
	<regexp region="NumberDec" match="/\b\d+%numsuf;\b/"/>
</scheme>

<scheme name="Operator">
	<keywords region="Separator">
		<symb name=","/>
		<symb name=";"/>
	</keywords>
	<keywords region="Operator">
		<symb name="$"/>
		<symb name="*"/>
		<symb name="/"/>
		<symb name=":"/>
		<symb name="@"/>
		<symb name="^"/>
		<symb name="~"/>
		<symb name="+"/>

		<symb name="!="/>

		<symb name="-&gt;&gt;"/>
		<symb name="-&gt;"/>
		<symb name="-"/>

		<symb name="&gt;="/>
		<symb name="&gt;"/>

		<symb name="=="/>
		<symb name="="/>

		<symb name="&amp;&amp;"/>
		<symb name="&amp;"/>

		<symb name="||"/>
		<symb name="|"/>

		<symb name="&lt;&lt;-"/>
		<symb name="&lt;-"/>
		<symb name="&lt;="/>
		<symb name="&lt;"/>

		<!--%auto%-->
		<symb name="%%"/>
		<symb name="%*%"/>
		<symb name="%/%"/>
		<symb name="%in%"/>
		<symb name="%o%"/>
		<symb name="%x%"/>
	</keywords>

	<!--!-->
	<regexp match="/(?{Operator}!)/"/>

	<!--%user%-->
	<regexp match="/(?{Keyword}%)(?{UserOperator}[^%]+)(?{Keyword}%)/"/>
</scheme>

<scheme name="Constant">
	<keywords region="Constant">
		<word name="TRUE"/>
		<word name="FALSE"/>
		<word name="NULL"/>
		<word name="Inf"/>
		<word name="NaN"/>
		<word name="NA"/>
		<word name="NA_integer_"/>
		<word name="NA_real_"/>
		<word name="NA_complex_"/>
		<word name="NA_character_"/>
	</keywords>
</scheme>

<scheme name="Keyword">
	<keywords region="Keyword">
		<word name="if"/>
		<word name="else"/>
		<word name="repeat"/>
		<word name="while"/>
		<word name="for"/>
		<word name="in"/>
		<word name="next"/>
		<word name="break"/>
	</keywords>

	<!--..., ..N-->
	<regexp match="/\B\.\.(?:\.\B|\d+\b)/" region="Keyword"/>
</scheme>

<scheme name="Comment">
	<inherit scheme="def:Comment"/>
</scheme>

<scheme name="r">
	<regexp match="/(?{def:default}\s+)/"/>

	<!--###-->
	<regexp match="/(?{Comment}(?{def:Outlined}#{3}#?!.*))/"/>

	<!--#-->
	<block scheme="Comment" region="Comment"
	start="/#/" end="/$/"/>

	<!--'', ""-->
	<block scheme="String" region="String"
	start="/(?{start}(?{StringEdge}['&#34;]))/" end="/(?{end}(?{StringEdge}\y{start}))/"/>

	<!--``-->
	<block scheme="def:empty" region="String"
	start="/(?{start}(?{StringEdge}`))/" end="/(?{end}(?{StringEdge}`))/"/>

	<inherit scheme="Operator"/>

	<!--Function-->
	<regexp match="/\b(function)\b/i" region1="def:FunctionKeyword" region="def:Outlined"/>

	<inherit scheme="def:PairedBrackets">
		<virtual scheme="def:PairedBrackets" subst-scheme="r"/>
	</inherit>

	<inherit scheme="Constant"/>

	<inherit scheme="Keyword"/>

	<inherit scheme="Number"/>

	<regexp match="/%id;/" region="Identifier"/>
</scheme>
</type>
</hrc>
<!--
LICENSE
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
-
- The contents of this file are subject to the Mozilla Public License Version
- 1.1 (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
- http://www.mozilla.org/MPL/
-
- Software distributed under the License is distributed on an "AS IS" basis,
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- for the specific language governing rights and limitations under the
- License.
-
- The Original Code is the Colorer Library.
-
- The Initial Developer of the Original Code is
- Cail Lomecb <cail@nm.ru>.
- Portions created by the Initial Developer are Copyright (C) 1999-2005
- the Initial Developer. All Rights Reserved.
-
- Contributor(s):
- Roman Kuzmin
-
- Alternatively, the contents of this file may be used under the terms of
- either the GNU General Public License Version 2 or later (the "GPL"), or
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- in which case the provisions of the GPL or the LGPL are applicable instead
- of those above. If you wish to allow use of your version of this file only
- under the terms of either the GPL or the LGPL, and not to allow others to
- use your version of this file under the terms of the MPL, indicate your
- decision by deleting the provisions above and replace them with the notice
- and other provisions required by the LGPL or the GPL. If you do not delete
- the provisions above, a recipient may use your version of this file under
- the terms of any one of the MPL, the GPL or the LGPL.
-->
